package com.nulstudio.sppm.Service;

import com.nulstudio.sppm.Dao.WarehouseMapper;
import com.nulstudio.sppm.Entities.Warehouse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WarehouseService {
    @Autowired
    private WarehouseMapper warehouseMapper;
    public List<Warehouse> getAllWarehouses(){
        return warehouseMapper.getAllWarehouses();
    }
    public int addWarehouse(Warehouse warehouse){
        warehouseMapper.addWarehouse(warehouse);
        return warehouseMapper.getLastId();
    }

    public int modifyWarehouse(Warehouse warehouse){
        return warehouseMapper.modifyWarehouse(warehouse);
    }

    public int deleteWarehouse(int id){
        return warehouseMapper.deleteWarehouse(id);
    }
    public List<Warehouse> getWarehouseById(int id){
        return warehouseMapper.getWarehouseById(id);
    }
}
